<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height:100px;
            background-color: red;
            animation-name:move;/*动画名称*/
            animation-duration:3s;/*动画持续时间*/
            animation-delay:3s;/*动画延迟时间*/
            animation-iteration-count: 2;/*动画的执行次数*/
            animation-iteration-count:infinite;/*无限循环*/
            animation-direction: reverse;/*设定动画是否交替起点*/
            animation-direction:alternate;
            animation-fill-mode:forwards;/*定义动画开始前后的停留位置*/
        }
        /*声明轨迹*/
        /* @keyframes move{
            from{
                margin-left: 0px;
                background-color: crimson;
            }
            to{
                margin-left: 500px;
                background-color: chartreuse;
            }
        } */
        @keyframes move{
            0%{
                margin-left: 0px;
                background-color: crimson;
            }
            50%{
                background-color: pink;
            }
            100%{
                margin-left: 500px;
                background-color: orange;
            }
        }
    </style>
</head>
<body>
    <div></div>
</body>
</html>